//Unit test for fullDeckCount()

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <assert.h>

#define _NUM_TESTS 100

int main() {
	srand (time(NULL));

	int i;
	int calculated;
    int card;
	struct gameState state;
	int player = 0;
	
	int test = 0;
	while(test++ != _NUM_TESTS) {
		calculated = 0;
		card = rand() % 27;
		state.handCount[player] = rand() % (MAX_HAND + 1);
		for (i = 0; i < state.handCount[player]; ++i) {
			if(card == (state.hand[player][i] = rand() % 27))
				++calculated;
		}

		state.discardCount[player] = rand() % (MAX_DECK + 1);
		for (i = 0; i < state.discardCount[player]; ++i) {
			if(card == (state.discard[player][i] = rand() % 27))
				++calculated;
		}

		state.deckCount[player] = rand() % (MAX_DECK + 1);
		for (i = 0; i < state.deckCount[player]; ++i) {
			if(card == (state.deck[player][i] = rand() % 27))
				++calculated;
		}
		
		assert(calculated == fullDeckCount(player, card, &state));
	}
	
	printf("Passed.\n");
	
	return 0;
}
